import request from '@/utils/request'
// , setToken, removeToken
import { getToken } from '@/utils/auth'

export function fetchList(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/getShipmentRecords',
    method: 'get',
    params: query
  })
}

export function getMaterialDetails(shipmentNo) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/selectByShipmentNo/' + shipmentNo,
    method: 'get',
    params: null
  })
}

export function addShipmentRecord(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/addShipmentRecord',
    method: 'post',
    headers: { 'Content-Type': 'multipart/form-data' },
    data
  })
}

export function updateDetailByid(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/updateDetailByid',
    method: 'get',
    params: data
  })
}

export function deleteDetailByid(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/deleteDetailByid',
    method: 'get',
    params: data
  })
}

export function deleteShipmentByShipmentNo(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/deleteShipmentByShipmentNo',
    method: 'get',
    params: data
  })
}

export function recoveryArchivesByshipmentNo(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/recoveryArchivesByshipmentNo',
    method: 'get',
    params: data
  })
}

export function generateShipmentByNo(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/generateShipmentByNo',
    method: 'get',
    params: data
  })
}

export function importMaterialDetails(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/importMaterialDetails',
    method: 'post',
    data
  })
}

export function getPartnerInfo() {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/getPartnerInfo',
    method: 'get',
    params: null
  })
}

export function addShipmentAndDetails(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/addShipmentAndDetails',
    method: 'get',
    params: data
  })
}

export function importShipmentAndMaterialDetails(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/importShipmentAndMaterialDetails',
    method: 'post',
    data
  })
}

export function splitCommit(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/shipment/splitRecord',
    method: 'get',
    params: data
  })
}
